package com.zhentao.config;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

/**
 * @Date 2024/2/23 11:44
 * @Author xdm
 **/
@Data
@EnableConfigurationProperties(MinIoConfigProperties.class)
public class MinIoConfig {
    @Autowired
    private MinIoConfigProperties minIoConfigProperties;
    
    @Bean
    public MinioClient builMinioClient(){
        return MinioClient.builder()
                .credentials(minIoConfigProperties.getAccessKey(), minIoConfigProperties.getSecretKey())
                .endpoint(minIoConfigProperties.getEndpoint())
                .build();
    }
}
